{!! Html::style(env("APP_URL").'/assets/backend/admin/css/jquery-ui.min.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/common.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/angular-motion.min.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/order.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/multiselect.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/slideGallery.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/printTemplate.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/aiui.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/postil.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/libs/jquery-ui-1.9.2/css/ui-lightness/jquery-ui-1.9.2.custom.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/libs/jqGrid/css/ui.jqgrid.css') !!}

<style>
    .sumData_text {
        color: red;
    }
</style>
@include('shop-backend::includes.loading')
<div class="tabs-container" ng-app="JxApp" style="min-height: 500px; display: none">
    <div class="tab-content" ng-controller="FormModule" id="FormCtrl">
        <div class="single-pannel">
            <form class="form-inline searchForm ng-pristine ng-valid" role="form" id="searchForm"
                  style="padding-bottom: 0;">
                <div class="group-item">
                    <label>商品：</label>
                    <div class="form-group ">
                        <input type="text" name="searchKey" id="searchKey" style="width: 130px;"
                               class="form-control ng-pristine ng-valid" ng-model="searchVO.searchKey"
                               placeholder="名称、货号、条码">
                    </div>
                </div>
                <div class="group-item">
                    <label>分类：</label>
                    <div class="form-group ">
                        <select class="form-control ng-isolate-scope ng-pristine ng-valid" levelsel="" id="categoryId"
                                loptions="allCategory" ng-model="searchVO.categoryId">
                            <option value="">-请选择-</option>
                        </select>
                    </div>
                </div>
                <div class="group-item">
                    <label>品牌：</label>
                    <div class="form-group ">
                        <div style="display: inline-block; width: 110px;">
                            <exselect ng-model="selBland" sel-val="searchVO.blandId" name="blandId" id="blandId"
                                      data="allBland" datareader="{text:'name',val:'id'}" placeholder="-请选择-"
                                      exoptions="[{text:'-请选择-',val:''}]" class="ng-isolate-scope ng-pristine ng-valid">
                                <div class="ms_container " ng-click="clickIn()" ng-mouseleave="mouseleave()">
                                    <input ng-model="MsModel.text" readonly="readonly" value="" name="mstxt_blandId"
                                           id="mstxt_" placeholder="-请选择-" ng-disabled="disabled"
                                           class="ng-pristine ng-valid">
                                    <input ng-model="selVal" value="" type="hidden" name="blandId" id=""
                                           class="ng-pristine ng-valid">
                                    <span class="caret"></span>


                                </div>
                            </exselect>
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <label>颜色：</label>
                    <div class="form-group ">
                        <div style="display: inline-block; vertical-align: middle; width: 120px;">
                            <exselect ng-model="searchColor" sel-val="search.colorIds" data="allColorJson"
                                      datareader="{text:'name',val:'id'}" placeholder="-请选择-"
                                      exoptions="[{text:'-请选择-',val:''}]" class="ng-isolate-scope ng-pristine ng-valid">
                                <div class="ms_container " ng-click="clickIn()" ng-mouseleave="mouseleave()">
                                    <input ng-model="MsModel.text" readonly="readonly" value="" name="mstxt_"
                                           id="mstxt_" placeholder="-请选择-" ng-disabled="disabled"
                                           class="ng-pristine ng-valid">
                                    <input ng-model="selVal" value="" type="hidden" name="" id=""
                                           class="ng-pristine ng-valid">
                                    <span class="caret"></span>


                                </div>
                            </exselect>
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <label>尺码：</label>
                    <div class="form-group ">
                        <div style="display: inline-block; vertical-align: middle; width: 120px;">
                            <exselect ng-model="searchSize" sel-val="search.sizeIds" data="allSizeJson"
                                      datareader="{text:'name',val:'id'}" placeholder="-请选择-"
                                      exoptions="[{text:'-请选择-',val:''}]" class="ng-isolate-scope ng-pristine ng-valid">
                                <div class="ms_container " ng-click="clickIn()" ng-mouseleave="mouseleave()">
                                    <input ng-model="MsModel.text" readonly="readonly" value="" name="mstxt_"
                                           id="mstxt_" placeholder="-请选择-" ng-disabled="disabled"
                                           class="ng-pristine ng-valid">
                                    <input ng-model="selVal" value="" type="hidden" name="" id=""
                                           class="ng-pristine ng-valid">
                                    <span class="caret"></span>
                                </div>
                            </exselect>
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <label>款式：</label>
                    <div class="form-group ">
                        <div style="display: inline-block; vertical-align: middle; width: 120px;">
                            <exselect ng-model="searchStyle" sel-val="search.styleId" data="allStyleJson"
                                      datareader="{text:'name',val:'id'}" placeholder="-请选择-"
                                      exoptions="[{text:'-请选择-',val:''}]" class="ng-isolate-scope ng-pristine ng-valid">
                                <div class="ms_container " ng-click="clickIn()" ng-mouseleave="mouseleave()">
                                    <input ng-model="MsModel.text" readonly="readonly" value="" name="mstxt_"
                                           id="mstxt_" placeholder="-请选择-" ng-disabled="disabled"
                                           class="ng-pristine ng-valid">
                                    <input ng-model="selVal" value="" type="hidden" name="" id=""
                                           class="ng-pristine ng-valid">
                                    <span class="caret"></span>
                                </div>
                            </exselect>
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <label>年份：</label>
                    <div class="form-group ">
                        <div style="display: inline-block; vertical-align: middle; width: 120px;">
                            <exselect ng-model="searchYear" sel-val="search.year" data="allYears"
                                      datareader="{text:'name',val:'id'}" placeholder="-请选择-"
                                      exoptions="[{text:'-请选择-',val:''}]" class="ng-isolate-scope ng-pristine ng-valid">
                                <div class="ms_container " ng-click="clickIn()" ng-mouseleave="mouseleave()">
                                    <input ng-model="MsModel.text" readonly="readonly" value="" name="mstxt_"
                                           id="mstxt_" placeholder="-请选择-" ng-disabled="disabled"
                                           class="ng-pristine ng-valid">
                                    <input ng-model="selVal" value="" type="hidden" name="" id=""
                                           class="ng-pristine ng-valid">
                                    <span class="caret"></span>
                                </div>
                            </exselect>
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <label>季节：</label>
                    <div class="form-group ">
                        <div style="display: inline-block; vertical-align: middle; width: 120px;">
                            <exselect ng-model="searchSeason" sel-val="search.seasonId" data="seasons"
                                      datareader="{text:'name',val:'id'}" placeholder="-请选择-"
                                      exoptions="[{text:'-请选择-',val:''}]" class="ng-isolate-scope ng-pristine ng-valid">
                                <div class="ms_container " ng-click="clickIn()" ng-mouseleave="mouseleave()">
                                    <input ng-model="MsModel.text" readonly="readonly" value="" name="mstxt_"
                                           id="mstxt_" placeholder="-请选择-" ng-disabled="disabled"
                                           class="ng-pristine ng-valid">
                                    <input ng-model="selVal" value="" type="hidden" name="" id="season_filter_id"
                                           class="ng-pristine ng-valid">
                                    <span class="caret"></span>
                                </div>
                            </exselect>
                        </div>
                    </div>
                </div>

                <div class="group-item ">
                    <label class="sel-a"><input class="sel-a" type="checkbox" checked
                                                ng-model="searchVO.zeroNumber" name="zeroNumber" id="zeroNumber">过滤零库存</label>&nbsp;&nbsp;
                </div>


                <div class="group-item ">
                    <div class="setting-content" style="display: inline; padding-right: 10px;">
                        <label><input type="radio" name="listModel" id="checkListModel_1" ng-change="checkListModel()"
                                      ng-model="displayItem.listModel" value="1"
                                      class="ng-valid ng-dirty">商品列表&nbsp;</label> <label><input type="radio"
                                                                                                 name="listModel"
                                                                                                 id="checkListModel_2"
                                                                                                 ng-change="checkListModel()"
                                                                                                 ng-model="displayItem.listModel"
                                                                                                 value="2"  checked="checked"
                                                                                                 class="ng-valid ng-dirty">单品列表</label>
                    </div>
                </div>
                <div class="form-group" style="margin-left: 0px; margin-right: 0px;">
                    <button class="btn-normal" style="width: 56px; padding: 0px;" type="button" ng-click="search();"
                            id="searchBtn" value="0">查询
                    </button>
                </div>
                <div class="group-item " style="margin-left: 0px; margin-right: 0px;">
                    <button class="btn-normal" ng-click="changeShowSumData();">
                        <span style="color: #fff;" ng-bind="getShowSumDataText();" class="ng-binding">展示统计数据</span>
                    </button>
                </div>

                <div class="group-item " style="margin-left: 0px; margin-right: 0px;">
                    <a href="{{route('admin.shop.goods.importStock')}}" class="btn btn-primary">导入库存</a>
                </div>

                <div class="group-item" style="margin-left: 0px;margin-right: 0px">
                    <a class="export-goods" data-toggle="modal-filter"
                       data-target="#download_modal" data-backdrop="static" data-keyboard="false"
                       data-link="{{route('admin.goods.getExportData',['type'=>'xls'])}}"
                       id="xls"
                       data-url="{{route('admin.export.index',['toggle'=>'xls'])}}"
                       data-type="xls"
                       href="javascript:;">导出xls格式</a>
                </div>
            </form>
            <table class="list-title-bar" ng-show="showSumData" ng-style="showSumDataStyle">
                <tbody>
                <tr>
                    <td style="width: 40%;" class="left-container">
                        <div ng-show="!sumDataLoading" class="">
                            <span class="title">当前汇总结果：库存总数量 </span><span class="text ng-binding sumData_text"
                                                                          ng-bind="sumData.totalQuantity"></span>&nbsp;&nbsp;&nbsp;&nbsp;
                            <span class="title" ng-show="resources.indexOf('storehouseSummaryView') != -1">库存总成本 </span><span
                                    ng-show="resources.indexOf('storehouseSummaryView') != -1"
                                    class="text ng-binding sumData_text"
                                    ng-bind="sumData.totalPurchaseAmount|currency:'￥'"></span>
                        </div>
                        <div ng-show="sumDataLoading" class="ng-hide">查询中...</div>
                    </td>
                </tr>
                </tbody>
            </table>
            <div class="grid-wrap">
                <table id="list_section"></table>
                <div id="pager"></div>
            </div>
            <!-- 滑动相册 -->
        {{--<div id="slideGallery" class="container slider" style="display: none;">
            <div class="filedel" title="关闭窗口" onclick="closeGallery();" style="z-index: 100;"></div>
            <div ng-repeat="slide in slides" class="slide slide-animation nonDraggableImage" ng-swipe-right="nextSlide()" ng-swipe-left="prevSlide()" ng-hide="!isCurrentSlideIndex($index)">
                <img ng-src="@{{slide.url}}">
            </div>
            <a class="arrow prev" href="#" ng-click="nextSlide()"></a>
            <a class="arrow next" href="#" ng-click="prevSlide()"></a>
        </div>--}}

        <!-- 调整表单 -->
            <div id="adjustDialog" style="display: none">
                <div ng-show="savingGoodsStoredSet" class="text-center loadding">
                    <span>保存中，请稍后...</span>
                </div>
                <form ng-show="!savingGoodsStoredSet" class="form-horizontal" novalidate name="adjustForm">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">商品:</label>
                        <div class="col-sm-4 ">
                            <div class=" input-group">
                                <input class="form-control" ng-model="adjustVO.goodsName" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">颜色:</label>
                        <div class="col-sm-4 ">
                            <div class=" input-group">
                                <input class="form-control" ng-model="adjustVO.colorName" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-4 control-label">尺码:</label>
                        <div class="col-sm-4 ">
                            <div class=" input-group">
                                <input class="form-control" ng-model="adjustVO.sizeName" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-4 control-label">当前库存:</label>
                        <div class="col-sm-4 ">
                            <div class=" input-group">
                                <input class="form-control" ng-model="adjustVO.quantity" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-4 control-label">盘点数量:</label>
                        <div class="col-sm-4 validate_input">
                            <div class=" input-group">
                                <input style="position: initial;" class="form-control" ng-model="adjustVO.number"
                                       id="adjustNumber" ng-pattern="/^[0]|[1-9][0-9]{0,7}$/" name="adjustNumber"
                                       type="number" min="0" max="99999999" required>
                            </div>
                            <div ng-show="adjustForm.adjustNumber.$dirty && adjustForm.adjustNumber.$invalid"
                                 class="error_container">
                                <div class="error_tip">
                                    <div class="error_led">
                                        <span></span>
                                    </div>
                                    <span ng-show="adjustForm.adjustNumber.$error.required">盘点数量为必输项.</span>
                                    <span ng-show="adjustForm.adjustNumber.$error.pattern">输入值必须是大于等于0且不超过8位的整数.</span>
                                    <span ng-show="adjustForm.adjustNumber.$error.number || adjustForm.adjustNumber.$error.min">输入值必须为整数且大于等于0</span>
                                    <span ng-show="adjustForm.adjustNumber.$error.max">输入值最大为99999999.</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">备注:</label>
                        <div class="col-sm-6 ">
                            <input class="form-control" type="text" ng-model="adjustVO.remark">
                        </div>
                    </div>
                    <div class="btn-group text-center">
                        <button class="btn-normal" ng-click='directAdjust($event)' ng-disabled="adjustForm.$invalid">
                            盘点
                        </button>
                        <button class="btn-normal" ng-click='cancleAdjust($event)'>取消</button>
                    </div>
                </form>
            </div>
            <!-- 调整表单end -->
        </div>
    </div>
</div>

<div id="download_modal" class="modal inmodal fade"></div>

{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-animate.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-resource.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-sanitize.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/ng-currency.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-cookie.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-locale_zh-cn.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/ui-bootstrap-tpls-0.10.0.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-strap.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-strap.tpl.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/service.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/checklist-model.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/jui-select.js') !!}

{!! Html::script(env("APP_URL").'/assets/backend/libs/jqGrid/js/i18n/grid.locale-cn.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/libs/jqGrid/js/jquery.jqGrid.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/libs/jquery-ui-1.9.2/js/jquery-ui-1.9.2.custom.js') !!}

<script>
    var base = '{{ env('APP_URL') }}';
    var allBland = {!! json_encode($brandList) !!};
    var allCategory = {!! json_encode($allCategories) !!};
    var allCategoryList = {!! json_encode($categories) !!};
    var strSeasonListJson = {!! json_encode($seasons) !!};
    var strStyleListJson = {!! json_encode($styles) !!};
    var allYears = {!! json_encode($years) !!};
    var allSizes = {!! json_encode($sizes) !!};
    var allColors = {!! json_encode($colors) !!};
</script>
@include('shop-backend::includes.loading-script')
@include('shop-backend::purchase.includes.common')
@include('shop-backend::stockRecord.mulselect')
@include('shop-backend::stockQuery.levelselect')
@include('shop-backend::stockQuery.goodsStoredList')

<script>
    $(document).on('click.modal.data-api', '[data-toggle="modal-filter"]', function (e) {
        var $this = $(this),
            href = $this.attr('href'),
            modalUrl = $(this).data('url');


        var url = '{{route('admin.shop.goods.getExportData')}}';
        var type = $(this).data('type');

        url = url + '?type=' + type;

        $(this).data('link', url);

        if (modalUrl) {
            var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, '')));
            $target.modal('show');
            $target.html('').load(modalUrl, function () {

            });
        }
    });
</script>